home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-04
/
pxewin.zip
/
BROWSE.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1992-02-27
|
4KB
|
114 lines
// PXEWIN - (C) Copyright 1992 by Beam Engineering, INC.
// BROWSE.HPP //
// Contents ----------------------------------------------------------------
//
// This module contains the Browser class. This class creates an MDI
// compatible child window.
//
// End ---------------------------------------------------------------------
// External Reference Name for this Header ---------------------------------
#ifndef BROWSE_HPP
#define BROWSE_HPP
// End ---------------------------------------------------------------------
// Interface Dependencies --------------------------------------------------
#ifndef DBDISPLY_HPP
#include "dbdisply.hpp"
#endif // DBDISPLY_HPP //
// End ---------------------------------------------------------------------
// class Browser //
class Browser:public TWindow
{
private:
int flag; /* Existance flag for window
bailout */
long XScroll; /* This is the starting XPos
of the scroller. */
virtual const Pchar streamableName()
const /* Defines the streamable
name for this class. */
{
return "Browser";
}
protected:
virtual Pvoid read(Ripstream); /* Read persistant object */
virtual void write(Ropstream); /* Write persistant object */
public:
DBDISPLAY *my_display; /* Database display pointer
*/
Pchar name; /* Name of database file */
Browser(PTWindowsObject AParent,int ChildNum);
Browser(StreamableInit): /* Persistant object
constructor */
TWindow(streamableInit)
{
}
static PTStreamable build(); /* Build persistant object */
virtual ~Browser();
virtual void SetupWindow();
int GetDB(); /* Get the database */
int RetFlag() /* Return existance flag */
{
return flag;
}
// The following stream readers are not the same as read and write
// used by TStreamable. When you create an object using a
// streamable constructor, it calls the read member after the object
// is constructed. This is not alway desirable. There is no point
// in constructing Browser without constructing a TWindow. If I
// write this object to the stream as well as it's base classes then
// I'll have to construct the window exactly as it last was
// constructed. But if the database changes from my last session
// (i.e. a structure change) then I have a problem. Also, I want
// to come up in the MDI frame window then load the desk top file.
// I'll have to figure a way to pass the MDI parent pointer to the
// reconstructed window after it's been created. Punt!
// A better way is to construct the Browser as usual and only
// read or write what you need to restore or save the window.
// That's what these functions do. As a general rule, constuctors
// that have no parameters or are of the default type lend themselves
// well as persistant objects. As soon as you start passing a lot
// of parameters, you've got some real headaches.
virtual int ReadChildren(Ripstream); /* Read input stream */
virtual void WriteChildren(Ropstream); /* Write output stream */
void SetScroller(); /* Sets the vertical scroller
to coorespond to the
current position in the
database. */
};
// Description -------------------------------------------------------------
//
// This class will be used for each browser window you wish to use.
//
// End ---------------------------------------------------------------------
// Define inserters and extractors for persistant objects:
inline Ripstream operator >> (Ripstream is,RBrowser cl)
{return is >> (RTStreamable)cl;}
inline Ripstream operator >> (Ripstream is,RPBrowser cl)
{return is >> (RPvoid)cl;}
inline Ropstream operator << (Ropstream os,RBrowser cl)
{return os << (RTStreamable)cl;}
inline Ropstream operator << (Ropstream os,PBrowser cl)
{return os << (PTStreamable)cl;}
#endif // BROWSE_HPP //